![](/file/19402/ADC Tools Sampler CD Disk 3 1999.iso/Documentation/CodeWarrior/HTML/Targeting_Java_VM/images/tbar.gif)
A
Standalone Applets for Mac OS
You can use CodeWarrior to create standalone Mac OS Java applications. This release of CodeWarrior uses a method for creating standalone Java applications which makes use of JBindery. This chapter will walk you through creating standalone applications.
Using JBindery, CodeWarrior "binds" the neccessary code to your Java code to make standalone applications.
Topics discussed in this section are:
JBindery is an application that binds the VM interface to Java code to create standalone Java applications. It is supplied with the Mac OS Runtime for Java (MRJ) software development kit from Apple Computer Inc. MRJ can be found on the CodeWarrior CD in the Cool Demos, SDKs, & Tools folder. For more information on JBindery and other parts of the MRJ SDK, see the documentation provided with MRJ.
Following is a step-by-step guide to creating a standalone Mac OS Java application using JBindery.
1. Create a new Java project.
Choose File > New Project
. Select Java Application
from the Java section and click OK
. CodeWarrior will ask you to name and save the new project to your hard disk via a standard save file dialog box.
2. Add your Java files.
Choose Project > Add Files
to add your Java source files to the project. Make sure you add your files to the correct build target if you have more than one build target in your project.
3. Open the Target Settings dialog box.
Choose Edit > Java Application Settings
to open the Target Settings dialog box.
NOTE:
The wording of this menu item changes to reflect the name of the build target being displayed in the project window. If you changed the name of your build target, then look for that name in this menu.
4. Activate the Java Mac OS Post Linker.
Click Target Settings in the panel list on the left-hand side of the dialog box. The Target Settings panel appears. Choose Java Mac OS Post Linker from the Post-Linker pop-up menu This activates the Java Mac OS Post Linker and tells CodeWarrior to use the settings in the Java Mac OS Settings panel when building your project
5. Change the main class setting.
Click Java Target in the panel list on the left-hand side of the dialog box. The Java Application Settings dialog box appears. Click on Target Settings in the panel list to the left of the dialog box to display the Target Settings panel. Change the Main Class
field to the same name as your application's main class.
6. Set the Output Type.
Select Java Mac OS Settings from the panel list on the left-hand side of the dialog box. This displays the Java Mac OS Settings panel.
Choose JBindery from the Mac OS Java Output Type pop-up menu.
7. Redirect stdin and stdout.
If you want stdin
and stdout
to be redirected or ignored, choose the appropriate menu items in the two Redirect pop-up menus.
8. Set the Creator and Output Filename.
Change the Creator and Output Filename fields to the creator and filename you want your application to have.
9. Set the Minimum and Maximum heap sizes.
Set the Minimum app heap to the minimum number of bytes your application will be allowed to run in. Set the Maximum app heap to the prefered number of bytes for your applications heap.
10. Save your settings.
Click the Save button at the bottom of the dialog box to save all of your settings. Then close the dialog box.
11. Compile and run.
Choose Project > Make
to create your application. Once it has been successfully built, double-click it's icon to run it.
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: support@metrowerks.com
Copyright © 1999, Metrowerks Corp. All rights reserved.
Last updated: May 24, 1999
* Chris Magnuson
* John Roseborough